#version 330 core

struct Material 
{
    sampler2D texture_diffuse1;
    sampler2D texture_specular1;
    sampler2D texture_ambient1;
};

uniform Material material;
uniform samplerCube skybox;
uniform vec3 cameraPos;

in vec3 Normal;
in vec3 FragPos;
in vec2 TexCoords;
in vec3 ViewFragPos;

out vec4 FragColor;

void main()
{
    vec3 norm = normalize(Normal);
    vec3 I = normalize(FragPos - cameraPos);
    vec3 R = reflect(I, normalize(Normal));
    vec4 reflectColor = vec4(texture(skybox, R).rgb, 1.0) * texture(material.texture_ambient1, TexCoords);
    vec4 specularColor = texture(material.texture_specular1, TexCoords);
    vec4 diffuseColor = vec4(vec3(texture(material.texture_diffuse1, TexCoords)) , 1.f);
    // 加上diffuseColor无法渲染
    FragColor = reflectColor * 1.5 + specularColor;
}